From: Jyrki Gadinger Date: Thu, 15 May 2025 14:11:38 +0000 (+0200) Subject: feat(mac-crafter): retry code-signing attempts X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1^2~13^2~1^2~32^2 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=8c68c97c03c15a113c5a47905297603525bcb2ff;p=nextcloud-desktop.git feat(mac-crafter): retry code-signing attempts This step sometimes fails with an error such as: "A timestamp was expected but was not found.". Any code-signing errors will result in the notarisation step to fail. Apparently this might be due to intermittent network issues. Let's just retry codesigning a couple of times in the case it fails ... See also: https://developer.apple.com/documentation/security/resolving-common-notarization-issues#Include-a-secure-timestamp Signed-off-by: Jyrki Gadinger --- diff --git a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift index 1f43d3e49..927133133 100644 --- a/admin/osx/mac-crafter/Sources/Utils/Codesign.swift +++ b/admin/osx/mac-crafter/Sources/Utils/Codesign.swift @@ -55,9 +55,17 @@ func isExecutable(_ path: String) throws -> Bool { func codesign(identity: String, path: String, options: String = defaultCodesignOptions) throws { print("Code-signing \(path)...") let command = "codesign -s \"\(identity)\" \(options) \"\(path)\"" - guard shell(command) == 0 else { - throw CodeSigningError.failedToCodeSign("Failed to code-sign \(path).") + for _ in 1...5 { + guard shell(command) == 0 else { + print("Code-signing failed, retrying ...") + continue + } + + // code signing was successful + return } + + throw CodeSigningError.failedToCodeSign("Failed to code-sign \(path).") } func recursivelyCodesign(